<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input id="k" type="text" value="name">
    <input id="v" type="text" value="Jack">
    <input id="btn" type="button" value="tset">
    <script>
        var k = document.getElementById('k');
        var v = document.getElementById('v');
        var btn = document.getElementById('btn');
        var o = {};
        btn.onclick =function(){
            o[k.value] = v.value;
            console.log(o);
        };
    </script>
</body>
</html>